<?php
namespace app\admin\controller;
use app\admin\controller\BaseController;
use think\Db;
use think\Controller;
/**
 * 后台首页
 * Class Index
 */
class IndexController extends BaseController {

	/**
	 * 首页
	 * @return mixed
	 */
	public function index() {
		$members=db('member')->field('count(id)counts')->find();
 		$today_member=db("member")->wheretime('add_time','today')->count('id');
 		$week_member=db("member")->wheretime("add_time","week")->count("id");
 		$month_member=db('member')->wheretime('add_time','month')->count('id');
 		$this->assign('month_member',$month_member);
		$this->assign('today_member',$today_member);
		$this->assign('week_member',$week_member);
		$this->assign('members',$members);
		return $this->fetch();
	}
	
	/**
	 * 清除缓存
	 */
	public function clear() {
		if (delete_dir_file(CACHE_PATH) || delete_dir_file(TEMP_PATH)) {
			$this->success('清除缓存成功');
		} else {
			$this->error('清除缓存失败');
		}
	}


}
